package com.qfmy.webapp.controller.user;

import com.qfmy.common.result.Result;
import com.qfmy.model.vo.user.UserCouponVo;
import com.qfmy.webapp.service.user.UserCouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 清风明月
 * @Package com.qfmy.web.app.controller.user
 * @date 2025/11/12
 * @description 用户优惠卷
 */
@RestController
@RequestMapping("/app/userCoupon")
@SuppressWarnings("all")
public class UserCouponController {

    /**
     * 注入service
     */
    @Autowired
    private UserCouponService userCouponService;

    /**
     * 根据优惠卷的类型获取优惠卷
     */
    @RequestMapping("/getUserCouponByType")
    public Result<List<UserCouponVo>> getUserCouponByType(@RequestParam Integer type) {
        List<UserCouponVo> list = userCouponService.getUserCouponByType(type);
        return Result.ok(list);
    }

    /**
     * 获取所有的优惠卷
     */
    @RequestMapping("/getAllUserCoupon")
    public Result<List<UserCouponVo>> getAllUserCoupon() {
        List<UserCouponVo> list = userCouponService.getAllCoupon();
        return Result.ok(list);
    }

}
